import React from 'react';
import { Navigate } from '../react-router';

function Protected(props) {
    let { component:RouteComponent,path } = props
    return (
        localStorage.getItem('login')?<RouteComponent/>:<Navigate to={{
            pathname:'/login',
            state:{
                from:path
            }
        }}></Navigate>
    );
}

export default Protected;